from machine import Timer
from filter import Adcimport time
class Recoder(Adc):
  def __init__(self):
    self.adc = Adc()
    self.file = None
    tim = Timer(-1)
  def start(self):
    def recodeing(w):
      self.file.write(str(self.adc.read_one())+'\n')
    self.file = open('position.txt','w')
    tim.init(period=100, mode=Timer.PERIODIC, callback=recodeing)
  def stop(self):
    tim.deinit()
    self.file.close()
    
recode = Recoder()
recode.start()
time.sleep(5)
recode.stop()